package it.xiuxian.personcenter.presenter

import com.lzy.okgo.OkGo
import it.xiuxian.lib.base.BaseBean
import it.xiuxian.lib.base.BasePresenter
import it.xiuxian.lib.base.ILoadBind
import it.xiuxian.lib.http.CallBackOption
import it.xiuxian.lib.http.HttpConfig
import it.xiuxian.lib.utils.EncodeUtils
import it.xiuxian.personcenter.activity.GongGaoDetailActivity
import it.xiuxian.personcenter.bean.GongGaoSetailBean
import org.json.JSONObject

class GongGaoDetailActivityPresenter:BasePresenter<GongGaoDetailActivity>() {
    fun getDetail(id:String){
        var json1 = JSONObject()
        json1.put("id",id)
        OkGo.post<BaseBean<GongGaoSetailBean>>(HttpConfig.BASE_URL+"/appnotice/get")
            .params("encrypt", EncodeUtils.encodeAES(json1.toString()))
            .execute(object : CallBackOption<BaseBean<GongGaoSetailBean>>() {}.loadBind(mView as GongGaoDetailActivity).execute(
                object : ILoadBind<BaseBean<GongGaoSetailBean>> {
                    override fun excute(bean: BaseBean<GongGaoSetailBean>) {
                        if(bean.code==0){
                            (mView as GongGaoDetailActivity).geData(bean.data)
                        }
                    }
                }
            ))
    }
}